
%\documentclass[letterpaper,12pt]{article}
%\usepackage[x11names,rgb]{xcolor}
%\usepackage{tikz}
%\usetikzlibrary{snakes}
%\usetikzlibrary{arrows}
%\usetikzlibrary{shapes}
%\usetikzlibrary{backgrounds}
%\usepackage{amsmath}
%\oddsidemargin 0in
%\evensidemargin 0in
%\topmargin 0in
%\headheight 0in
%\headsep 0in
%\textheight 9in
%\textwidth 6.5in
%\begin{document}
%\pagestyle{empty}
%\vspace*{\fill}
%\begin{center}
\documentclass{article}
 
\usepackage[pdftex,active,tightpage]{preview}
\usepackage{tikz}
\usetikzlibrary{snakes}
\usetikzlibrary{arrows}
\makeatletter
 
\begin{document}
\begin{preview}
	%%
	\begin{tikzpicture}[scale=0.6]
		    	% domain boundary 
		  		\draw (0,0) rectangle (8,8);
		  		%% blocks ...
		  		\draw[fill=red!30] (0,0) rectangle +(4,4);
		  		\draw[fill=green!30] (4,0) rectangle +(4,4);
		  		\draw[fill=orange!30] (0,4) rectangle +(8,4);
		  		\draw[fill=orange!30] (4,4) rectangle +(4,2);
		  		\draw[fill=blue!30] (4,6) rectangle +(4,2);
		  		%\draw[fill=orange!30] (4,6) rectangle +(1,1);
		  		%\draw[fill=orange!30] (7,3) rectangle +(1,1);
		  		%\draw[fill=green!30] (3,3) rectangle +(1,1);
		  		%draw[fill=green!30] (2.5,3.5) rectangle +(0.5,0.5);
		  		
		  		%% octree ...
		  		\draw[black, very thin, step=4cm] (0,0) grid (8,8);	
		  		\draw[black, very thin, step=2cm] (0,0) grid +(4,4);	
		  		\draw[black, very thin, step=2cm] (4,0) grid +(4,4);	
		  		\draw[black, very thin, step=2cm] (4,4) grid +(4,4);
		  		
		  		%\draw[black, very thin, step=1cm] (4,6) grid +(2,2);	
		  		%\draw[black, very thin, step=1cm] (2,2) grid +(2,2);	
		  		%\draw[black, very thin, step=1cm] (6,2) grid +(2,2);	
		  		
		  		%\draw[black, very thin, step=0.5cm] (2,3) grid +(1,1);	
		  		%\draw[black, very thin, step=0.5cm] (7,3) grid +(1,1);	
	    	
	    	\end{tikzpicture}%%
\end{preview}
\end{document}

%\end{center}
%\vspace*{\fill}
%\end{document}
    	